#!/bin/bash


db="mysql"
jdbc_driver="com.mysql.cj.jdbc.Driver"

################# db.properties
echo "db=$db" >> /tmp/db.properties
echo "jdbc.driver=$jdbc_driver" >> /tmp/db.properties
echo "jdbc.url=$jdbc_url" >> /tmp/db.properties
echo "jdbc.username=$jdbc_username" >> /tmp/db.properties
echo "jdbc.password=$jdbc_password" >> /tmp/db.properties
# update db.properties
cd /tmp
jar uf /usr/src/myapp/ab-workflow-1.0.jar db.properties
# echo "===check  db.properties"
# unzip -q -c /usr/src/myapp/ab-workflow-1.0.jar db.properties

################ dubbo.properties
jar xf /usr/src/myapp/ab-workflow-1.0.jar dubbo.properties
sed -i "s@dubbo.registry.address=.*@dubbo.registry.address=$zk@g" dubbo.properties
jar uf /usr/src/myapp/ab-workflow-1.0.jar dubbo.properties
# echo "===check  dubbo.properties"
# unzip -q -c /usr/src/myapp/ab-workflow-1.0.jar dubbo.properties

######## run jar
java -Djava.security.egd=file:/dev/./urandom -jar /usr/src/myapp/ab-workflow-1.0.jar
